package com.quanxiaoha.xiaohashu.note.biz.controller;


import com.quanxiaoha.framework.biz.operationlog.aspect.ApiOperationLog;
import com.quanxiaoha.framework.common.response.Response;
import com.quanxiaoha.xiaohashu.note.biz.model.vo.*;
import com.quanxiaoha.xiaohashu.note.biz.service.NoteDOService;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: jingyan_liu
 * @CreateTime: 2025-07-30
 * @Description:
 * @Version: 1.0
 */


@RestController
@RequestMapping("/note")
@Slf4j
public class NoteController {
	
	@Resource
	private NoteDOService noteService;
	
	@PostMapping(value = "/publish")
	@ApiOperationLog(description = "笔记发布")
	public Response<?> publishNote(@Validated @RequestBody PublishNoteReqVO publishNoteReqVO) {
		return noteService.publishNote(publishNoteReqVO);
	}
	
	@PostMapping(value = "/detail")
	@ApiOperationLog(description = "笔记详情")
	public Response<FindNoteDetailRspVO> findNoteDetail(@Validated @RequestBody FindNoteDetailReqVO findNoteDetailReqVO) {
		return noteService.findNoteDetail(findNoteDetailReqVO);
	}
	
	@PostMapping(value = "/update")
	@ApiOperationLog(description = "笔记修改")
	public Response<?> updateNote(@Validated @RequestBody UpdateNoteReqVO updateNoteReqVO) {
		return noteService.updateNote(updateNoteReqVO);
	}
	
	@PostMapping(value = "/delete")
	@ApiOperationLog(description = "删除笔记")
	public Response<?> deleteNote(@Validated @RequestBody DeleteNoteReqVO deleteNoteReqVO) {
		return noteService.deleteNote(deleteNoteReqVO);
	}
	
	@PostMapping(value = "/visible/onlyme")
	@ApiOperationLog(description = "笔记仅对自己可见")
	public Response<?> visibleOnlyMe(@Validated @RequestBody UpdateNoteVisibleOnlyMeReqVO updateNoteVisibleOnlyMeReqVO) {
		return noteService.visibleOnlyMe(updateNoteVisibleOnlyMeReqVO);
	}
	
}
